package com.wingsboat.data.transmission.config.asyncthread;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @Author: wangzhong
 * @Date: 2023/11/7 15:17
 * @Description: Async多线程自定义拒绝策略
 **/
@Component
public class SuRejectHandle implements RejectedExecutionHandler {
    private static final Logger log = LoggerFactory.getLogger(SuRejectHandle.class);

    @Override
    public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
        //打印丢失的线程任务
        log.error("线程[{}],[{}]任务丢失",Thread.currentThread().getName(),r);
    }
}
